package com.lianniu.web.app.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.lianniu.web.app.dao.IDetailListAppDao;
import com.lianniu.web.app.dao.IStatistiCallListAppDao;
import com.lianniu.web.app.service.IStatistiCallListAppService;
import com.lianniu.web.base.BaseResult;
@Service
public class StatistiCallListAppServiceImpl implements IStatistiCallListAppService {

    @Autowired
    IStatistiCallListAppDao statistiCallListAppDao;
    @Autowired
    IDetailListAppDao detailListAppDao;
  
    /**
     * 修改统计表
     */
    @Override
    @Transactional(value="app",isolation=Isolation.DEFAULT,propagation=Propagation.NESTED,rollbackFor={Exception.class})
    public BaseResult statisticalNum(String ip,String sys, String type) {
       detailListAppDao.insertDetailList(ip, sys, type);
        int i = statistiCallListAppDao.exsit(sys, type);
        if(i==0){
            statistiCallListAppDao.insertStatistical(sys, type);
        }else{
            statistiCallListAppDao.updateStatistical(sys, type);
        }
        return BaseResult.success();
    }

}
